package com.cssy.xxkj.logic.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicProdDispatchingDetailDAO;
import com.cssy.xxkj.logic.entity.LogicProductionDispatchingDetailDO;
import com.cssy.xxkj.logic.entity.LogicProductionDispatchingDetailItemDO;
import com.cssy.xxkj.logic.entity.vo.LogicProductionDispatchingDetailItemVO;
import com.plat.exception.SyBaseException;
import com.plat.helper.SearchConditions;

public class LogicProdDispatchingDetailDAOImpl extends SqlMapClientDaoSupport implements LogicProdDispatchingDetailDAO {

	@Override
	public String insertLogicProductionDispatchingDetailDO(
			LogicProductionDispatchingDetailDO logicProductionDispatchingDetailDO) {
		Object id = getSqlMapClientTemplate().insert("LogicProductionDispatchingDetail.insert", logicProductionDispatchingDetailDO);
        return (String) id;
	}

	@Override
	public Integer countLogicProductionDispatchingDetailDOByExample(
			LogicProductionDispatchingDetailDO logicProductionDispatchingDetailDO) {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionDispatchingDetail.countByDOExample", logicProductionDispatchingDetailDO);
        return count;
	}

	@Override
	public Integer updateLogicProductionDispatchingDetailDO(
			LogicProductionDispatchingDetailDO logicProductionDispatchingDetailDO) {
		int result = getSqlMapClientTemplate().update("LogicProductionDispatchingDetail.update", logicProductionDispatchingDetailDO);
        return result;
	}

	@Override
	public List<LogicProductionDispatchingDetailDO> findListByExample(
			LogicProductionDispatchingDetailDO logicProductionDispatchingDetailDO) {
		 List<LogicProductionDispatchingDetailDO> list = getSqlMapClientTemplate().queryForList("LogicProductionDispatchingDetail.findListByDO", logicProductionDispatchingDetailDO);
	     return list;
	}

	@Override
	public LogicProductionDispatchingDetailDO findLogicProductionDispatchingDetailDOByPrimaryKey(
			String id) {
		LogicProductionDispatchingDetailDO logicProductionDispatchingDetailDO = (LogicProductionDispatchingDetailDO) getSqlMapClientTemplate().queryForObject("LogicProductionDispatchingDetail.findByPrimaryKey", id);
        return logicProductionDispatchingDetailDO;
	}

	@Override
	public Integer deleteLogicProductionDispatchingDetailDOByPrimaryKey(
			String id) {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionDispatchingDetail.deleteByPrimaryKey", id);
        return rows;
	}

	@Override
	public List<LogicProductionDispatchingDetailDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicProductionDispatchingDetailDO> list = getSqlMapClientTemplate().queryForList("LogicProductionDispatchingDetail_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionDispatchingDetail_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().delete("LogicProductionDispatchingDetail_ex.deleteBizRemoved", id);
        return count;
	}

	@Override
	public List<LogicProductionDispatchingDetailItemVO> findDispatchingDetailBySCS(
			SearchConditions scs) throws SyBaseException {
		return getSqlMapClientTemplate().queryForList("LogicProductionDispatchingDetail_ex.findDispatchingDetailBySCS", scs);
	}

	@Override
	public Integer findDispatchingDetailCountBySCS(SearchConditions scs)
			throws SyBaseException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionDispatchingDetail_ex.findDispatchingDetailCountBySCS", scs);
		return count;
	}
	
	/**
	 * 派工汇总表
	 */
	@Override
	public List findDispatchingDetailToSum(SearchConditions scs)throws SyBaseException{
		return null;
	}
   	
	@Override
   	public Integer countDispatchingDetailToSum(SearchConditions scs)throws SyBaseException{
		//Integer count = (Integer)getSqlMapClientTemplate().queryForObject("LogicProductionDispatchingDetail_ex.countDispatchingDetailToSum", scs);
		return null;
	}

	@Override
	public List<LogicProductionDispatchingDetailItemVO> findCollectDispatchingDetailBySCS(
			SearchConditions scs) throws SyBaseException {
		return getSqlMapClientTemplate().queryForList("LogicProductionDispatchingDetail_ex.findCollectDispatchingDetailBySCS", scs);
	}
}
